/*------------------------------------------------------
                hou_elearningGEN beta v1.0
Author: xtrung.net@gmail.com
Write On: 04/27/2008
Create On:4/13/2012 11:22:46 AM
------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace hou_elearning.Entity
{
    public class ChucnangEntity
    {
        public ChucnangEntity()
        {
			m_pk_ichucnangid=0;
			m_stenchucnang="";
			m_skyhieu="";
			m_sghichu="";
        }
		private Int32 m_pk_ichucnangid;
		public Int32 PK_iChucnangID
		{
			get { return m_pk_ichucnangid ; }
			set { m_pk_ichucnangid = value; }
		}
		private String m_stenchucnang;
		public String sTenchucnang
		{
			get { return m_stenchucnang ; }
			set { m_stenchucnang = value; }
		}
		private String m_skyhieu;
		public String sKyhieu
		{
			get { return m_skyhieu ; }
			set { m_skyhieu = value; }
		}
		private String m_sghichu;
		public String sGhichu
		{
			get { return m_sghichu ; }
			set { m_sghichu = value; }
		}

        #region Comparison
        public static List<ChucnangEntity> Sort(List<ChucnangEntity> list, String SortExpression, String SortDirection)
        {
            string strComparisonAttrb="COMPARISON_"+SortExpression;
            PropertyInfo propInfo= typeof(ChucnangEntity).GetProperty(strComparisonAttrb);
            if (propInfo != null)
            {
                list.Sort(propInfo.GetGetMethod().Invoke(null,null) as Comparison<ChucnangEntity>);
                if (SortDirection == "DESC")
                    list.Reverse();
            }
            return list;
        }
        
		public static Comparison<ChucnangEntity> COMPARISON_PK_iChucnangID
		{
			get
			{
				return delegate(ChucnangEntity entity,ChucnangEntity other)
				{
					return entity.PK_iChucnangID.CompareTo(other.PK_iChucnangID);
				};
			}
		}
		public static Comparison<ChucnangEntity> COMPARISON_sTenchucnang
		{
			get
			{
				return delegate(ChucnangEntity entity,ChucnangEntity other)
				{
					return entity.sTenchucnang.CompareTo(other.sTenchucnang);
				};
			}
		}
		public static Comparison<ChucnangEntity> COMPARISON_sKyhieu
		{
			get
			{
				return delegate(ChucnangEntity entity,ChucnangEntity other)
				{
					return entity.sKyhieu.CompareTo(other.sKyhieu);
				};
			}
		}
		public static Comparison<ChucnangEntity> COMPARISON_sGhichu
		{
			get
			{
				return delegate(ChucnangEntity entity,ChucnangEntity other)
				{
					return entity.sGhichu.CompareTo(other.sGhichu);
				};
			}
		}
        #endregion
    }
}
